a = 0


def task(a):
    a += 1
    print(a)


from multiprocessing import Process, Lock

if __name__ == '__main__':
    l = []
    lock = Lock()
    for i in range(5):
        p = Process(target=task, args=(a,))
        p.start()
        l.append(p)
    for p in l:
        p.join()
    print(a)
